/*
 * ConfigLoader.h
 *
 *  Created on: Sep 30, 2010
 *      Author: gabriel
 */

#ifndef CONFIGLOADER_H_
#define CONFIGLOADER_H_

#include <iostream>
#include <map>
#include <fstream>
#include <cstdlib>

namespace Utility
{
	typedef std::map<std::string , std::string> ConfigLoaderMap;
	typedef struct	str_config_ret
	{
		std::string data;

		int toint();
		float tofloat();
		long tolong ();
		std::string tostring ();
	}ConfigRet;

	enum cfg_status {
		ERROR,
		DONE,
		FILE_READ_ERROR,
		NO_CONFIG_AVIABLE
	};

	class ConfigLoader
	{
	public:
		ConfigLoader();
		virtual ~ConfigLoader();

		int loadFile ( std::string fileToLoad );
		ConfigRet getConf ( std::string index );

	private:
		std::string cfgFileName;
		ConfigLoaderMap cfgFileMap;

		bool findInMap ( std::string index );
	};

}

#endif /* CONFIGLOADER_H_ */
